-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@radoslawkrzemien/13604 local testing of GitHub actions #21937
@radoslawkrzemien/13604 local testing of GitHub actions #21937
Conversation
Add repo to gitignore See: Expensify#13604
Added new packages, most importantly `Mock-github` for creating a local repository for testing (to have better control over which files are accessed by the locally run workflows) and `Act-js` for programatically triggering the workflows with Act (with features added on top of it, like mocking API calls, mocking steps, etc.) See: Expensify#13604
Added `jest` and `ts` config files in a new folder `workflow_tests` for the testing of GitHub Actions workflows See: Expensify#13604
Added the stub of the first proper test, with the more-or-less defined structure, but yet without proper step mocks and result assertions See: Expensify#13604
Updated the mocks/test repo files configuration to be more readable/maintainable. Also added `name` properties to `preDeploy` workflow steps, since using `name` is the easiest and most stable way of referencing the steps for mocking See: Expensify#13604
Updated the step mocks to allow for producing outputs that steer the further workflow execution. Also added run params to the act call See: Expensify#13604
Added the option to assert the output of workflow run and compare it to a set of expected values See: Expensify#13604
Added the tests to check what happens when either of `lint` or `test` jobs fails, namely if `confirmPassingBuild` job gets executed and all jobs depending on `lint` and `test` being successful do not See: Expensify#13604
The test file is getting way too big, I will have to split it into several files, but for now did some refactoring for maintainability See: Expensify#13604
Extracted step mocks, assertion helper methods and utils methods to their separate files to clean up the already cluttered test file See: Expensify#13604
Added tests for new contributor message job See: Expensify#13604
Changed all typescript code into javascript code and removed ts-related dependencies See: Expensify#13604
Added a helper method to utils, that helps with creating step mocks - easier than mocking them by hand, allows reusability and reduces the chance of a typo sneaking in See: Expensify#13604
Added a helper method to utils, that helps with creating mock step assertions - easier than typing them by hand, allows reusability and reduces the chance of a typo sneaking in See: Expensify#13604
Forgot to previously remove tsconfig.json See: Expensify#13604
…taging [WiP] Added the tests checking for which steps get executed based on given set of conditions See: Expensify#13604
Added the test checking if the workflow does not get executed if the code is pushed to a different branch than main See: Expensify#13604
Added the test checking if the workflow does not get executed if the triggering event is different from `push` See: Expensify#13604
Started working on the tests documentation See: Expensify#13604
Added a new section to documentation with structure of the workflow testing framework See: Expensify#13604
Added a new section to documentation with the description and example usage of utils helper methods See: Expensify#13604
Added a new section to documentation with the detail breakdown of the structure of typical test file See: Expensify#13604
Self-explanatory See: Expensify#13604
Added the test checking if the failed workflow gets announced on Slack See: Expensify#13604
Added new section to readme, about setting up the environment for running tests See: Expensify#13604
Added tests for the deploy.yml workflow and fixed the setActParams method See: Expensify#13604
Self-explanatory See: Expensify#13604
Updated event options and local repo pushed branches See: Expensify#13604
Added test checking if deploy workflow does not execute on a different event than push See: Expensify#13604
Added test first working test for platformDeploy workflow, along with all the mocks and assertions See: Expensify#13604
Added `tests` and `.github` dirs to the overrides removing check for `no-async-await` See: Expensify#13604
…04-local-testing-of-github-actions # Conflicts: # .github/workflows/platformDeploy.yml # .github/workflows/verifyPodfile.yml
Updated tests after merge See: Expensify#13604
@dangrous Added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet! We're now in the merge freeze so this will probably have to wait until that's over.... (And so we'll likely need one more commit to fix merge conflicts at the end there.)
But this works for me until then!
Thanks for your patience as this continues on.
Oops, looks like some lint errors too |
Run prettier See: Expensify#13604
…04-local-testing-of-github-actions # Conflicts: # .eslintrc.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving but will hold on a merge through the freeze (unless you feel we can go ahead @AndrewGable, it does seem pretty self-contained so it would probably be fine?)
Hey guys, any updates? Is there anything left for me to do, or just waiting now for the merge? |
I think we're just waiting for the merge (the freeze should be up at the end of this week) unless @AndrewGable has any final comments! |
okay we're off the freeze, can you merge main and resolve any conflicts please? Thanks! |
…04-local-testing-of-github-actions # Conflicts: # .github/workflows/finishReleaseCycle.yml # .github/workflows/preDeploy.yml # package-lock.json
Resolved conflicts and updated tests after merging from upstream See: Expensify#13604
Hey @radoslawkrzemien can you give a quick summary of the merge conflicts that you updated? It's hard to know exactly what happened since there's so much code haha. Namely:
@AndrewGable let us know if you notice anything else, otherwise I think I'll be good to merge after that! |
Hey @dangrous The StagingDeployCash steps have been removed in As for the LMK if something needs more clarification |
Great that all makes sense to me! I think we can merge! |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/dangrous in version: 1.3.70-0 🚀
|
@dangrous Could you please help us with 1st step in QA |
Hey @kavimuru ! I think this won't actually need QA, it only affects dev, so y'all can ignore. (Unless I'm mistaken, @radoslawkrzemien ) |
You are correct @dangrous , it should only affect dev |
🚀 Deployed to production by https://github.com/thienlnam in version: 1.3.70-8 🚀
|
Details
Testing framework for running local tests of GitHub Actions workflows to identify issues before pushing them into the repository and testing there
Fixed Issues
$ #13604
$ #13604 (comment)
Tests
npm run workflow-test
Offline tests
QA Steps
npm run workflow-test
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android